//
//  WNCurrentReadVC.swift
//  WalkNovel
//
//  Created by Kevin on 2023/7/17.
//

import UIKit

class WNCurrentReadVC: WNBaseVC {

    lazy var readChapterView: ReadChapterView = {
        let view = ReadChapterView()
        return view
    }()
            
    var recordModel: BookRecordModel?

    override func viewDidLoad() {
        super.viewDidLoad()
    }
    
    override func viewConfig() {
        wn_hidNavView()
        view.addSubview(readChapterView)
        readChapterView.snp.makeConstraints { make in
            make.edges.equalTo(0)
        }
    }
    
    override func dataConfig() {
        readChapterView.content = recordModel?.contentAttributedString
        reloadProgress()
        darkModeConfig()
    }
    
    func darkModeConfig() {
        readChapterView.darkModeConfig()
    }
    
    func reloadProgress() {
        readChapterView.chapterLabel.text = recordModel?.chapterModel?.chapterName
        readChapterView.pageLabel.text = "\((recordModel?.page.intValue ?? 0) + 1)/\(recordModel?.chapterModel?.pageCount.intValue ?? 0)"
    }
}
